#include <iostream>
#include <cstring>
using namespace std;
struct score
{
    string name[10];       //10个同学的姓名，字符串
    int chinese[10];   //10个同学的语文成绩，单位（分）
    int math[10];      //10个同学的数学成绩，单位（分）
    int english[10];   //10个同学的英语成绩，单位（分）
}sc;
int sum (int a,int b,int c)
{
    return a + b + c;
} //求和函数
float average (int a[10])
{
    int sumaverage = 0;
    for (int i=0;i<10;i++)
        sumaverage +=a[i];
    return sumaverage/10;
} //平均值函数
int max (int a[10])
{
    int max = 0;
    for ( int i=0;i<10;i++ )
    {
        if( a[i]>max )
            max = a[i];        
    }
    return max;
} //最大值函数
int min (int a[10])
{
    int min = 10000;
        for ( int i=0;i<10;i++ )
        {
            if( a[i]<min )
                min = a[i];
            return min;
        }
} //最小值函数
int main()
{
    int score[3][10] = { {45,48,68,97,82,73,81,29,79.80},
                         {64,94,87,76,81,94,82,73,54,67},
                         {45,84,67,15,49,34,48,34,76,76} };
    //初始化10个同学的语文，数学，英语成绩
    string namesc[10] = {"zhao","xu","zhang","li","wang","qian","sun","xiao","wu","mo"};
    int scsum[10] = {};  //记录10个同学的总分
    cout << "每个学生的总分如下" <<endl;
    for ( int j=0;j<10;j++ )
    {
        sc.chinese[j] = score[0][j];
        sc.math[j] = score[1][j];
        sc.english[j] = score[2][j];
        sc.name[j] = namesc[j];
        scsum[j] = sum(sc.chinese[j],sc.math[j],sc.english[j]);
        cout << scsum[j] << " ,";       
    }   //将各科成绩导入到结构体成员变量中并计算总分
    cout <<endl;
    cout << "语文平均成绩： " << average(sc.chinese) <<endl;
    cout << "数学平均成绩： " << average(sc.math) <<endl;
    cout << "英语平均成绩： " << average(sc.english) <<endl;
    cout << "最高总分： " ;
    for ( int i=0;i<10;i++ )
        if ( scsum[i] == max(scsum) )
            cout << sc.name[i] << " ";
    cout << max(scsum) <<endl;
    cout << "最低总分： " ;
    for ( int i=0;i<10;i++ )
        if ( scsum[i] == min(scsum) )
            cout << sc.name[i] << " ";
    cout << min(scsum) <<endl;
    return 0; 
}